﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PioneerBoilerplate.Repository.UnitOfWorks
{
    public class InnerUnitOfWorkHandle<TDbContext> : IUnitOfWorkHandle<TDbContext> where TDbContext : DbContext
    {
        public bool IsDisposed { get; private set; }

        public void Dispose()
        {
            IsDisposed = true;
        }

        public TDbContext GetActiveUnitOfWork()
            => AsyncLocalCurrentUnitOfWorkHandleProvider<TDbContext>.Current?.GetActiveUnitOfWork();

        public int SaveChange()
        {
            return 0;
        }

        public Task<int> SaveChangeAsync()
        {
            return Task.FromResult(0);
        }
    }
}
